package com.dcw.lixb.designmode.adapter;

/**
 * @author lixiaobin
 * @date 2020-07-17 16:18:50
 * @desc 描述信息
 */
public class MediaAdapter implements MediaPlayer {
    AdvancedMediaPlayer mPlayer;

    public MediaAdapter(String audioType) {
        if ("vlc".equalsIgnoreCase(audioType)) {
            mPlayer = new VlcPlayer();
        } else if ("mp4".equalsIgnoreCase(audioType)) {
            mPlayer = new Mp4Player();
        }
    }

    @Override
    public void play(String audioType, String fileName) {
        if ("vlc".equalsIgnoreCase(audioType)) {
            mPlayer.playVlc(fileName);
        } else if ("mp4".equalsIgnoreCase(audioType)) {
            mPlayer.playMp4(fileName);
        }else {
            System.out.println("The type cannot be played !");
        }
    }
}
